package com.guozcc.bootweb.demo.component;

import com.guozcc.bootweb.demo.mapper.XszJdkxZbtjMapper;
import com.guozcc.bootweb.demo.pojo.XszJdkxZbtj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Component
public class DemoComponent {

    @Autowired
    private XszJdkxZbtjMapper xszJdkxZbtjMapper;

    public List<XszJdkxZbtj>  getList(XszJdkxZbtj xszJdkxZbtj){
        List<XszJdkxZbtj> xszJdkxZbtjs = xszJdkxZbtjMapper.selectList(xszJdkxZbtj);
        return xszJdkxZbtjs;
    }

    public List<XszJdkxZbtj>  getAll(){
        List<XszJdkxZbtj> xszJdkxZbtjs = xszJdkxZbtjMapper.selectAll();
        return xszJdkxZbtjs;
    }


    @Transactional(rollbackFor = Throwable.class)
    public void add(XszJdkxZbtj xszJdkxZbtj){
        xszJdkxZbtjMapper.insertSelective(xszJdkxZbtj);
    }
}
